package com.chenjun.common.util.email;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

import com.chenjun.common.util.ConfigUtil;

/**
 * 
 * @author ALLEN
 *
 */
public class MyAuthenticator extends Authenticator {
	
	private String userName = null;

	private String password = null;

	public MyAuthenticator() {
	}

	public MyAuthenticator(String username, String password) {
		this.setUserName(username);
		this.setPassword(password);
	}

	protected PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(ConfigUtil.getValue("",
				"email.sender"), ConfigUtil.getValue("", "email.password"));
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}